/**
* 作者: clz
* 日期: 2025-04-14 11:32:41
* 备注: 建筑升级表
*/
package com.motu.monstercity.server.game.commondata.union;
import io.vertx.core.json.JsonObject;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

public class UnionBuildUpgrade extends UnionBuildUpgradeModel {
	public static final int EFFECT_TYPE_MAIN  = UnionBuildMain.BUILD_ID_MAIN;//联盟总部 (增加联盟人礼中沽跃礼盒的可领取汉次数)
	public static final int EFFECT_TYPE_SHOP  = UnionBuildMain.BUILD_ID_SHOP;//1.解锁3个新的商品
	public static final int EFFECT_TYPE_BUSINESS  = UnionBuildMain.BUILD_ID_BUSINESS;//2.单次处理订单增加的点数+1的概率
//	public static final int EFFECT_TYPE_DISCOUNT_SHOP  = UnionBuildMain.BUILD_ID_DISCOUNT_SHOP;//3.砍价时使价格额外-{0}（固定值减少）
	public static final int EFFECT_TYPE_BOSS  = UnionBuildMain.BUILD_ID_BOSS;//远征战力加成
	public static final int EFFECT_TYPE_PK  = UnionBuildMain.BUILD_ID_PK;//




	private ConcurrentHashMap<Integer, Integer> effectTypeValue = new ConcurrentHashMap<>(); // 建筑升级的附加效果 《type,value》

	public UnionBuildUpgrade(JsonObject obj) {
		super(obj);
		String[] effectType = getEffectType().replace(" ", "").split(";");// 去除空格 按;划分
		String[] effectValue = getEffectlUpValue().replace(" ", "").split(";");// 去除空格 按;划分

		for (int i = 0; i < effectType.length; i++) {
			int effectTypeTmp = Integer.parseInt(effectType[i]);
			int effectTypeValueTmp = Integer.parseInt(effectValue[i]);
			effectTypeValue.put(effectTypeTmp,effectTypeValueTmp);
		}
	}

	/**
	 * 获取收益数值加成部分, 单位:万分比
	 * @param effectType
	 * @return
	 */
	public int getEffectTypeValue(int effectType) {
		return effectTypeValue.getOrDefault(effectType, 0);
	}

}
